// 版权所有 Epic Games, Inc. 保留所有权利。
#pragma once

#include "Interaction/InteractionQuery.h"
#include "Interaction/Tasks/AbilityTask_WaitForInteractableTargets.h"

#include "AbilityTask_WaitForInteractableTargets_SingleLineTrace.generated.h"

struct FCollisionProfileName;

class UGameplayAbility;
class UObject;
struct FFrame;

UCLASS()
class UAbilityTask_WaitForInteractableTargets_SingleLineTrace : public UAbilityTask_WaitForInteractableTargets
{
	GENERATED_UCLASS_BODY()

	virtual void Activate() override;

	/** 等待直到我们追踪到新的可交互对象集合。此任务自动循环。 */
	UFUNCTION(BlueprintCallable, Category="Ability|Tasks", meta = (HidePin = "OwningAbility", DefaultToSelf = "OwningAbility", BlueprintInternalUseOnly = "TRUE"))
	static UAbilityTask_WaitForInteractableTargets_SingleLineTrace* WaitForInteractableTargets_SingleLineTrace(UGameplayAbility* OwningAbility, FInteractionQuery InteractionQuery, FCollisionProfileName TraceProfile, FGameplayAbilityTargetingLocationInfo StartLocation, float InteractionScanRange = 100, float InteractionScanRate = 0.100, bool bShowDebug = false);

private:

	virtual void OnDestroy(bool AbilityEnded) override;

	void PerformTrace(); // 执行追踪

	UPROPERTY()
	FInteractionQuery InteractionQuery; // 交互查询

	UPROPERTY()
	FGameplayAbilityTargetingLocationInfo StartLocation; // 起始位置

	float InteractionScanRange = 100; // 交互扫描范围
	float InteractionScanRate = 0.100; // 交互扫描频率
	bool bShowDebug = false; // 是否显示调试信息

	FTimerHandle TimerHandle; // 定时器句柄
};